package cn.itsource.basic.domain;

import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.digest.MD5;

public interface CreatePassword {

    String getSalt();
    void setSalt(String salt);
    String getPassword();
    void setPassword(String password);

    default void initPwd(){
        String salt = IdUtil.fastSimpleUUID();

        String pwd = MD5.create().setSalt(salt.getBytes()).digestHex(this.getPassword());
        this.setSalt(salt);
        this.setPassword(pwd);

    }

}
